package com.sike.netty.jinjie.channel.embeddedchannel;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.Unpooled;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.codec.DelimiterBasedFrameDecoder;

import java.nio.charset.Charset;

public class EmbeddedChannelOutboundTest {
    public static void main(String[] args) {
        // 新建 EmbeddedChannel 对象
        EmbeddedChannel channel = new EmbeddedChannel(new ReplaceEncoder("|","&"));
        // 写入
        channel.writeOutbound("sike|netty|jinjie|EmbeddedChannel|");
        // 标记已完成
        channel.finish();

        // 读取数据验证
        System.out.println(channel.readOutbound().toString());
    }
}
